package com.good.msgsys.service.impl;

import com.good.msgsys.dao.LogDao;
import com.good.msgsys.entity.Log;
import com.good.msgsys.service.LogService;
import com.good.msgsys.utils.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author junlong
 * @date 2021/1/5 09:35
 */
@Service
public class LogServiceImpl implements LogService {
    @Autowired
    private LogDao logDao;
    @Autowired
    private IdWorker idWorker;

    @Override
    public void add(Log log) {
        String id = idWorker.nextId() + "";
        log.setId(id);
        logDao.save(log);
    }

    @Override
    public void deleteById(String id) {
        logDao.deleteById(id);
    }

    @Override
    public List<Log> findAll() {
        return logDao.findAll();
    }
}
